#include "x11player.h"
#include <iostream>
#include <sstream>
#include <fstream>

using namespace std;

int main()
{
    X11Player play;
    ifstream fstr;
    fstr.open("./testVideo/bgra.rgb", std::ios::in);
    if (!fstr.is_open()) {
        cout << "failed to open" << endl;
        return 0;
    }

    int wid = 54525955;    // 输入你的窗口ID
    cout << "wid:" << wid << endl;

    int blockSize = 320 * 180 * 4;
    char* buf = new char[blockSize];
    memset(buf, 0, blockSize);

    if (play.init(320, 180, (XID)wid) != 0) {
        cout << "init fail" << endl;
        return 0;
    }

    for (int i = 0 ; i < 100; i++) {
        fstr.read(buf, blockSize);
        play.inputRgb32(320, 180, buf);
        usleep(300000);
    }
    cout << "done";
    getchar();
    return 0;
}

